package com.qqt.csr.route.enums;

import cn.hutool.extra.spring.SpringUtil;
import com.qqt.csr.route.service.strategy.cs.CsRandomDistribution;
import com.qqt.csr.route.service.strategy.cs.ICsDistribution;
import com.qqt.csr.route.service.strategy.skillset.*;
import lombok.Getter;

/**
 * 技能组分发策略枚举类型
 */
@Getter
public enum SkillSetDistributionTypeEnum {

    RANDOM(0, "随机", SpringUtil.getBean(SkillSetRandomDistribution.class)),
    POLL(1, "轮询", SpringUtil.getBean(SkillSetPollDistribution.class)),
    CONVERSATION_COUNT_LEAST(2, "会话量少优先", SpringUtil.getBean(SkillSetConversationCountLeastDistribution.class)),
    CONVERSATION_TIME_LEAST(3, "会话时长低优先", SpringUtil.getBean(SkillSetConversationTimeLeastDistribution.class)),
    ;

    private Integer value;
    private String desc;
    private ISkillSetDistribution skillSetDistribution;

    SkillSetDistributionTypeEnum(int value, String desc, ISkillSetDistribution skillSetDistribution) {
        this.value = value;
        this.desc = desc;
        this.skillSetDistribution = skillSetDistribution;
    }

    public static SkillSetDistributionTypeEnum getByValue(Integer value) {
        for (SkillSetDistributionTypeEnum skillSetDistributionTypeEnum : values()) {
            if (skillSetDistributionTypeEnum.getValue().equals(value)) {
                return skillSetDistributionTypeEnum;
            }
        }
        return null;
    }
}
